package com.shouxin.attendance.view;

import android.app.Dialog;
import android.content.Context;
import android.support.annotation.StringRes;
import android.widget.TextView;

import com.shouxin.attendance.R;

public class CommonDialogWithText extends Dialog {

    private TextView mText;

    public CommonDialogWithText(Context context, boolean cancel) {
        this(context, null, cancel, null);
    }

    public CommonDialogWithText(Context context, boolean cancel, OnDismissListener listener) {
        this(context, null, cancel, listener);
    }

    public CommonDialogWithText(Context context, String text, boolean cancel, OnDismissListener listener) {
        super(context, R.style.CommonDialog);

        setCancelable(cancel);
        setCanceledOnTouchOutside(cancel);
        setContentView(R.layout.dialog_request_layout);

        setOnDismissListener(listener);

        mText = (TextView) findViewById(R.id.request_text);
        mText.setText(text);
    }

    public void setText(@StringRes int id) {
        mText.setText(id);
    }

    public void setText(String text) {
        mText.setText(text);
    }
}
